Fix typos in Memory Management chapter#95
Conversation
| * It can suffer from fragmentation. Basically there can be a lot of small freed areas that the allocator will not be able to use because of their size. A partial solution to this problem is described in the next paragraph. | ||
|
|
||
| Another thing worth doing to improve readability of the code is replace the direct pointer access with a more elegant data structure. This lets us add more fields (as we will in the next paragraph) as needed. | ||
| Another thing worth doing to improve readability of the code by replacing the direct pointer access with a more elegant data structure. This lets us add more fields (as we will in the next paragraph) as needed. |
There was a problem hiding this comment.
i'm happy with this change, but can you double check the sentence flow? Because the sentence starts with "Another thing worth doing ..." looks like something is missing? (i'm not native speaker so maybe it is correct)
|
|
||
| * Remember that every node has some overhead, so when splitting we shouldn't have nodes smaller (or equal to) than `sizeof(Heap_Node)`, because otherwise they will never be allocated. | ||
| * It's a good idea to have a minimum size for the memory a chunk can contain, to avoid having a large number of nodes and for easy alignment later on. For example if the minimum_allocable_size is 0x20 bytes, and we want to allocate 5 bytes, we will still receive a memory block of `0x20` bytes. The program may not know it was returned `0x20` bytes, but that is okay. What exactly value should be used for it is implementatin specific, values of `0x10` and `0x20` are popular. | ||
| * It's a good idea to have a minimum size for the memory a chunk can contain, to avoid having a large number of nodes and for easy alignment later on. For example if the minimum_allocatable_size is 0x20 bytes, and we want to allocate 5 bytes, we will still receive a memory block of `0x20` bytes. The program may not know it was returned `0x20` bytes, but that is okay. What exactly value should be used for it is implementation specific, values of `0x10` and `0x20` are popular. |
There was a problem hiding this comment.
I just noticed that minimum_allocatable_size could be rendered as code (minimum_allocatable_size).
|
Thanks a million for your contribution, just left two minor comments. |
|
Thanks for the feedback, I've fixed the issues accordingly :) |
|
Thanks again. I'll wait for your reply/action before merging |
|
Thanks again. |
A couple of typo and grammar fixes across the memory management chapter.